@extends('layouts.app')

@section('title')
    后台-入库历史查询
@stop

@section('extcss')
    <!--ext css-->
    <style>
        .btn-color{
            color:#93A2B2;border:1px solid rgba(221,226,232,0.49);
        }
        .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
            vertical-align: middle;
        }
    </style>
    <!-- /ext css-->
@stop

@section('content')
    <!-- page content -->
    <div class="right_col" role="main">
        <div class="">
            <div class="page-title">
                <div class="title_left">
                    <h3>入库历史查询</h3>
                </div>

                <div class="title_right">
                    <div class="col-md-5 col-sm-12 form-group pull-right top_search">
                        <div class="input-group">
                            <input id="txtKeyWorld" type="text" class="form-control" placeholder="款号查找">
                                <span class="input-group-btn">
                                  <button id="btnSearch" class="btn btn-default" type="button"><i class="fa fa-search" title="查找"></i></button>
                                </span>
                        </div>
                    </div>
                    <div class="col-md-7 col-sm-12 form-group pull-right top_search text-right">
                        <a href="{{url('system/assort/index')}}" class="btn btn-round btn-default btn-color"
                           type="button" title="新增" style="display:none;"><i class="fa fa-plus"></i></a>
                        <button id="btnSelectAll" class="btn btn-round btn-default btn-color" type="button" title="删除" style="display: none;">
                            <i class="fa fa-trash"></i></button>
                        <a href="javascript:window.location.reload();" class="btn btn-round btn-default btn-color"
                           type="button" title="刷新"><i class="fa fa-refresh"></i></a>
                        <button class="btn btn-round btn-default btn-color" type="button" title="下载" style="display: none;"><i
                                    class="fa fa-download"></i></button>
                        <button class="btn btn-round btn-default btn-color" type="button" title="打印" style="display: none;"><i
                                    class="fa fa-print"></i></button>
                    </div>
                </div>
            </div>

            <div class="clearfix"></div>

            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>历史入库记录</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>

                        <div class="x_content">
                            <div class="table-responsive">
                                <table class="table table-striped jambo_table bulk_action">
                                    <thead>
                                    <tr class="headings">
                                        <th class="column-title">订单号</th>
                                        <th class="column-title">姓名</th>
                                        <th class="column-title">地址</th>
                                        <th class="column-title">电话</th>
                                        <th class="column-title">状态</th>
                                        <th class="column-title">出库物流</th>
                                        <th class="column-title">物流单号</th>
                                        <th class="column-title">回库物流</th>
                                        <th class="column-title">物流单号</th>
                                        <th class="column-title">详情</th>
                                        <th class="column-title">操作</th>
                                    </tr>
                                    </thead>

                                    <tbody>
                                    @forelse($historyboxs as $box)
                                        <tr class="even pointer">
                                            <td class=" ">{{\Carbon\Carbon::parse($box->created_at)->format('YmdHis')}}</td>
                                            <td class=" ">{{$box->name}}</td>
                                            <td class=" ">{{$box->address}}</td>
                                            <td class=" ">{{$box->mobile}}</td>
                                            <td class=" "><button name="btnState" type="button" class="btn btn-success btn-xs" data-orderno="{{$box->orderno}}" disabled>{{$box->state->key}}</button></td>
                                            <td class=" ">{{$box->express_out_company}}</td>
                                            <td class=" ">{{$box->express_out_no}}</td>
                                            <td class=" ">{{$box->express_in_company}}</td>
                                            <td class=" ">{{$box->express_in_no}}</td>
                                            <td class=" "><a href="#box_{{$box->id}}" data-toggle="collapse"
                                                             aria-expanded="false" aria-controls="box_{{$box->id}}"
                                                             title="展开详细信息"><i class="fa fa-ellipsis-h"></i></a></td>
                                            <td class=" "><button class="btn btn-success btn-xs" title="入库操作者" disabled>{{$box->Keeper->name or '未指派'}}</button></td>
                                        </tr>
                                        <tr class="collapse" id="box_{{$box->id}}">
                                            <td colspan="12">
                                            @foreach($box->Assorts as $assort)
                                                <!--item-->
                                                    <div class="col-md-3 col-xs-12 widget widget_tally_box">
                                                        <div class="x_panel ui-ribbon-container">

                                                            <div class="x_content">
                                                                <div style="text-align: center; margin-bottom: 17px">
                                                                    <img class="img-thumbnail"
                                                                         src="{{asset("upload/images/".($assort->img ==null ? "default.png":pathinfo($assort->img)["basename"]))}}">
                                                                </div>
                                                                <div>
                                                                    <ul class="list-inline widget_tally">
                                                                        <li>
                                                                            <div class="form-group">
                                                                                <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">款号</label>
                                                                                <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                    <span class="" style="font-size: 20px"><mark>{{$assort->serial}}</mark></span>
                                                                                </div>
                                                                            </div>
                                                                        </li>
                                                                        <li>
                                                                            <div class="form-group">
                                                                                <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">尺码</label>
                                                                                <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                    <span class="lead"><mark>{{$assort->size}}</mark></span>
                                                                                </div>
                                                                            </div>
                                                                        </li>
                                                                        <li>
                                                                            <div class="form-group">
                                                                                <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">颜色</label>
                                                                                <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                    <span class="lead"><mark>{{$assort->color}}</mark></span>
                                                                                </div>
                                                                            </div>
                                                                        </li>
                                                                        <li>
                                                                            <div class="form-group">
                                                                                <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">分类</label>
                                                                                <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                    <span class="lead"><mark>{{$assort->category}}</mark></span>
                                                                                </div>
                                                                            </div>
                                                                        </li>
                                                                        <li>
                                                                            <div class="form-group">
                                                                                <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">数量</label>
                                                                                <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                    <span class="lead"><mark>{{$assort->number}}</mark></span>
                                                                                </div>
                                                                            </div>
                                                                        </li>
                                                                        <li>
                                                                            <div class="form-group">
                                                                                <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">状态</label>
                                                                                <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                    <span class="lead"><mark>{{$assort->state->key}}</mark></span>
                                                                                </div>
                                                                            </div>
                                                                        </li>
                                                                        <li>
                                                                            <div class="form-group">
                                                                                <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">操作者</label>
                                                                                <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                    <span class="lead"><mark>{{$assort->Keeper->name or '未指派'}}</mark></span>
                                                                                </div>
                                                                            </div>
                                                                        </li>
                                                                    </ul>
                                                                    <div class="clearfix"></div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <!-- /item-->
                                                @endforeach
                                            </td>
                                        </tr>
                                    @empty
                                        <tr class="even pointer">
                                            <td class="a-center text-center" colspan="13">
                                                没有查到记录
                                            </td>
                                        </tr>
                                    @endforelse
                                    </tbody>
                                    <tfoot>
                                    　　<tr>
                                        　　<td colspan="15">
                                            　　　@if($errors->any())
                                                <ul class="list-group">
                                                    @foreach($errors->all() as $error)
                                                        <li class="list-group-item list-group-item-danger">{{$error}}</li>
                                                    @endforeach
                                                </ul>
                                            @endif
                                        </td>
                                        　　</tr>
                                    　</tfoot>
                                </table>
                            </div>
                            <div class="row">
                                <div class="col-md-5 col-xs-12 col-sm-12 col-md-offset-5">{!! $historyboxs->links() !!}</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
    <!--goods image model-->
    <div class="modal fade bs-image-sm" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel2">商品图片</h4>
                </div>
                <div class="modal-body text-center">
                    <img src="" class="img-responsive img-thumbnail" alt="Responsive image">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default btn-block" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- /goods image model-->
    <!--goods remark model-->
    <div class="modal fade bs-remark-sm" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel3">商品备注信息</h4>
                </div>
                <div class="modal-body">
                    <p class="lead">...</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default btn-block" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- /goods remark model-->
    <!--goods delete model-->
    <div id="delModel" class="modal fade bs-delete-sm" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel4">删除提醒</h4>
                </div>
                <div class="modal-body">
                    <p class="lead">您确定要删除这行记录吗？</p>
                </div>
                <div class="modal-footer">
                    <div class="row">
                        <div class="col-md-6"><button id="btnModelDel" type="button" class="btn btn-default btn-block">删除</button></div>
                        <div class="col-md-6"><button type="button" class="btn btn-default btn-block" data-dismiss="modal">关闭</button></div>
                    </div>


                </div>
            </div>
        </div>
    </div>
    <!-- /goods remark model-->
@stop

@section('extjs')
    <!--ext js-->
    <!--search key world-->
    <script>
        $("#btnSearch").click(function () {
            var keyworld = $("#txtKeyWorld").val();

            window.location.href='/system/store/history/'+keyworld;
        });
    </script>
    <!--search key world-->
    <!-- /ext js-->
@stop